from django.conf.urls import url, include

from web.views import account, home, project, statistics, wiki, file, setting, issues, dashboard

urlpatterns = [
    url(r'^register/$', account.register, name="register"),  # 注册
    url(r'^send/sms/$', account.send_sms, name="send_sms"),  # 发送短信
    url(r'^login/sms/$', account.login_sms, name="login_sms"),  # 短信登录
    url(r'^login/$', account.login, name="login"),  # 用户名和密码登录
    url(r'^image/code/$', account.image_code, name="image_code"),  # 用户名和密码登录
    url(r'^logout/$', account.logout, name="logout"),  # 退出登录

    url(r'^index/$', home.index, name="index"),  # 首页

    url(r'^price/list/$', home.price, name="price"),  # 价格
    url(r'^payment/(?P<policy_id>\d+)/$', home.payment, name="payment"),  # 价格
    url(r'^pay/$', home.pay, name="pay"),  # 价格

    # 项目列表
    url(r'^project/list/$', project.project_list, name="project_list"),  # 项目列表
    url(r'^project/star/(?P<project_type>\w+)/(?P<project_id>\d+)/$', project.project_star, name='project_star'),
    # 添加星标
    url(r'^project/unstar/(?P<project_type>\w+)/(?P<project_id>\d+)/$', project.project_unstar, name='project_unstar'),
    # 取消星标

    # 项目管理
    url(r'^manage/(?P<project_id>\d+)/', include([
        url(r'^dashboard/$', dashboard.dashboard, name="dashboard"),
        url(r'^dashboard/issues/chart/$', dashboard.issues_chart, name="issues_chart"),

        url(r'^issues/$', issues.issues, name="issues"),
        url(r'^issues/detail/(?P<issues_id>\d+)/$', issues.issues_detail, name="issues_detail"),
        url(r'^issues/record/(?P<issues_id>\d+)/$', issues.issues_record, name="issues_record"),
        url(r'^issues/change/(?P<issues_id>\d+)/$', issues.issues_change, name="issues_change"),
        url(r'^invite/url/$', issues.invite_url, name="invite_url"),

        url(r'^statistics/$', statistics.statistics, name="statistics"),
        url(r'^statistics/priority/$', statistics.statistics_priority, name="statistics_priority"),
        url(r'^statistics/project/user/$', statistics.statistics_project_user, name="statistics_project_user"),

        url(r'^file/$', file.file, name="file"),
        url(r'^file/delete/$', file.file_delete, name="file_delete"),
        url(r'^file/post/$', file.file_post, name="file_post"),
        url(r'^file/download/(?P<file_id>\d+)/$', file.file_download, name="file_download"),

        url(r'^cos/credential/$', file.cos_credential, name="cos_credential"),

        url(r'^wiki/$', wiki.wiki, name="wiki"),
        url(r'^wiki/add/$', wiki.wiki_add, name="wiki_add"),
        url(r'^wiki/init_catalog/$', wiki.init_catalog, name="init_catalog"),
        url(r'^wiki/delete/(?P<wiki_id>\d+)/$', wiki.wiki_delete, name="wiki_delete"),
        url(r'^wiki/edit/(?P<wiki_id>\d+)/$', wiki.wiki_edit, name="wiki_edit"),
        url(r'^wiki/upload/$', wiki.wiki_upload, name="wiki_upload"),

        url(r'^setting/$', setting.setting, name="setting"),
        url(r'^setting/delete/$', setting.setting_delete, name="setting_delete"),
    ]), None, None),

    url(r'^invite/join/(?P<code>\w+)/$', issues.invite_join, name="invite_join"),
]
